Skip to content

GH-10058: Add Jackson 3 ObjectMapper and MessageParser #10160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 30, 2025

Conversation

anthologia
Copy link
Contributor

@anthologia anthologia commented Jun 23, 2025

Related to: #10058

  • Add Jackson3JsonObjectMapper, Jackson3JsonMessageParser to prepare for Jackson 2 to 3 migration (Work3).

Jackson 3 Exception Model Changes

Jackson 3 changed its exception hierarchy from checked to unchecked.

Now, JacksonException extends RuntimeException not IOException.

Jackson 3 default setting changes

Jackson 3.0 has different default settings compared to 2.x that may affect serialization behavior.

For example, these timestamp-related settings have changed:

  • WRITE_DATES_AS_TIMESTAMPS(false) // was true in 2.x
  • WRITE_DURATIONS_AS_TIMESTAMPS(false) // was true in 2.x
  • ONE_BASED_MONTHS(true) // was false in 2.x

Should we maintain Jackson 2.x compatibility, or adopt Jackson 3 defaults?

Copy link
Member

@artembilan artembilan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!
This is great start!
Any chances to have some tests on the matter?
Especially I'm interested in those loaded by the Jackson 3 modules if we remove our custom collectWellKnownModulesIfAvailable().

Re. defaults in v3 VS v2: I have raised concern with the team.
Will come back to ASAP.

Copy link
Member

@artembilan artembilan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The team decision is to keep Jackson 3 defaults since this is a major version it is better to dictate a modern protocols. Luckily, we expose an API to inject a customized ObjectMapper.

@anthologia anthologia force-pushed the GH-10058 branch 2 times, most recently from ad80fa8 to 76984b1 Compare June 26, 2025 13:05
Related to: spring-projects#10058

* Add Jackson3JsonObjectMapper, Jackson3JsonMessageParser to prepare for Jackson 2 to 3 migration.

Signed-off-by: Jooyoung Pyoung <[email protected]>
* Rename `Jackson3JsonObjectMapper` to `JacksonJsonObjectMapper`
* Rename `Jackson3JsonMessageParser` to `JacksonJsonMessageParser`
* Wrap `JacksonException` in `IOException` to maintain API contract
* Replace manual module collection with `findAndAddModules()`

Signed-off-by: Jooyoung Pyoung <[email protected]>
Signed-off-by: Jooyoung Pyoung <[email protected]>
* Add try-catch for valueToTree() call
* Remove conditional module checks in tests
* Update jsonAvailable() to check Jackson 3

Signed-off-by: Jooyoung Pyoung <[email protected]>
@anthologia anthologia requested a review from artembilan June 30, 2025 14:54
@artembilan artembilan added this to the 7.0.0-M1 milestone Jun 30, 2025
@artembilan artembilan merged commit 29e97b8 into spring-projects:main Jun 30, 2025
3 checks passed
@anthologia anthologia deleted the GH-10058 branch July 1, 2025 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants